#include <iostream>
using namespace std;

struct TreeNode {
    int val;
    TreeNode* left;
    TreeNode* right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

int getMaxDepth(TreeNode* root) {
    if (root == NULL) {
        return 0;
    }
    
    int leftDepth = getMaxDepth(root->left);
    int rightDepth = getMaxDepth(root->right);
    
    return max(leftDepth, rightDepth) + 1;
}

int main() {
    TreeNode* root = new TreeNode(1);
    root->left = new TreeNode(2);
    root->right = new TreeNode(3);
    root->left->left = new TreeNode(4);
    root->left->right = new TreeNode(5);
    
    int maxDepth = getMaxDepth(root);
    cout << "二叉树的最大深度为：" << maxDepth << endl;
    
    delete root->left->left;
    delete root->left->right;
    delete root->left;
    delete root->right;
    delete root;
    
    return 0;
}